import QtQuick 2.0
import QtQuick.Controls 2.5


Rectangle {
    id: root
    color: "transparent"
    radius: 4
    border.width: 1
    border.color: "#3986FF"
    opacity: enabled ? 1 : 0.5
    property alias _text: t.text
    property int _fontSize: Theme.font_size_13
    signal clicked()

    property color _normal_color: "transparent"
    property color _hover_color: "#E8F0FD"
    property color _pressed_color: "#C5D5FD"

//    property color _hover_color: "#E8F0FD"
//    property color _pressed_color: "#C5D5FD"

    MouseArea {
        anchors.fill: parent
        hoverEnabled: true
        onClicked: { root.clicked(); root.focus = true }
        onEntered: { color = _hover_color }
        onExited: { color = _normal_color }
        onPressed: { color = _pressed_color }
        onReleased: { color = _normal_color }
//        onEntered: { border.color = _hover_color; t.color = _hover_color }
//        onExited: { border.color = _normal_color; t.color = _normal_color }
//        onPressed: { border.color = _pressed_color; t.color = _pressed_color }
//        onReleased: { border.color = _normal_color; t.color = _normal_color }
    }

    CusText {
        id: t
        text: root.text
        anchors.centerIn: parent
        font.pixelSize: _fontSize

        color: "#3986FF"
    }

}
